﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.EntityModel;
using System.Runtime.Serialization;

namespace YasharEl.Infrastructure.Core.Prototype
{
    [Serializable]
    public class PropertyInvalidUsageException : DomainModelException
    {
        #region Fields

        private readonly Type _entityType;

        #endregion

        #region Getters

        public Type EntityType
        {
            get { return _entityType; }
        }

        #endregion

        public PropertyInvalidUsageException(string message, Type entityType)
            : base(string.Format("Invalid usage of property of entity '{0}'. Error {1}", entityType, message))
        {
            _entityType = entityType;
        }

        protected PropertyInvalidUsageException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }
    }
}
